﻿using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;


namespace MyEngineExercise
{
    internal class Constants
    {
        /// <summary>
        /// Shape file 的Dataset的一个Category (Shapefile Feature Class)
        /// </summary>
        public const String SHAPE_FILE_CATEGORY = "ShapeFile";



        #region 鼠标样式的文件名
        public const String CROSS_CURSOR_FILENAME = "Cross";
        public const String MOVEHAND_CURSOR_FILENAME = "MoveHand";
        public const String HAND_CURSOR_FILENAME = "Hand";
        #endregion


        #region 正则表达式
        /// <summary>
        /// 用于过滤鼠标样式文件，如：pan、cross
        /// </summary>
        public const String CURSOR_REGEX = @"^MyEngineExercise\.resources\.(?<curName>.+)\.cur$";

        #endregion


        #region 路径

        /// <summary>
        /// 工作路径，如：E:\study\MyEngineExercise\MyEngineExercise
        /// </summary>
        public static String WORK_FOLDER_PATH = Environment.CurrentDirectory.Replace("\\bin\\Debug", String.Empty);


        /// <summary>
        /// 如：E:\study\MyEngineExercise\MyEngineExercise\项目红线
        /// </summary>
        public static String RED_LINE_FOLDER_PATH = WORK_FOLDER_PATH + "\\项目红线";


        /// <summary>
        /// 如：E:\study\MyEngineExercise\MyEngineExercise\数据库
        /// </summary>
        public static String DB_FOLDER_PATH = WORK_FOLDER_PATH + "\\数据库";


        /// <summary>
        /// E:\study\MyEngineExercise\MyEngineExercise\数据库\鼎湖区空间数据库.mdb
        /// </summary>
        public static String DINGHU_SPATIAL_DB_PATH = DB_FOLDER_PATH + "\\鼎湖区空间数据库.mdb";


        /// <summary>
        /// E:\study\MyEngineExercise\MyEngineExercise\数据库\鼎湖区非空间数据库.mdb
        /// </summary>
        public static String DINGHU_NONSPATIAL_DB_PATH = DB_FOLDER_PATH + "\\鼎湖区非空间数据库.mdb";

        #endregion


        #region 可以由field类型转换为DataTable类型的field类型
        public static esriFieldType[] CAN_CHANGE_FIELD_TYPES = new esriFieldType[]
        {
            esriFieldType.esriFieldTypeDouble,
            esriFieldType.esriFieldTypeInteger,
            esriFieldType.esriFieldTypeOID,
            esriFieldType.esriFieldTypeSingle,
            esriFieldType.esriFieldTypeSmallInteger,
            esriFieldType.esriFieldTypeString
        };
        #endregion


        #region 创建项目红线相关
        public const String NUMBER_OF_POINT_FIELD_NAME = "界址点数";
        public const String AREA_FIELD_NAME = "面积公顷";//shape文件不能超过5个中文字，即10个字符
        public const String BLOCK_ID_FIELD_NAME = "地块编号";
        public const String BLOCK_NAME_FIELD_NAME = "地块名称";
        public const String GEOMETRY_TYPE_FIELD_NAME = "图形类型";
        public const String PAGE_NUM_FIELD_NAME = "图幅号";
        public const String CODE_FIELD_NAME = "地类编码";
        public const String USAGE_FIELD_NAME = "地块用途";
        public const String REMARK_FIELD_NAME = "描述";

        public static String[] FIELD_NAMES = new String[]
        {
            NUMBER_OF_POINT_FIELD_NAME,
            AREA_FIELD_NAME,
            BLOCK_ID_FIELD_NAME,
            BLOCK_NAME_FIELD_NAME,
            GEOMETRY_TYPE_FIELD_NAME,
            PAGE_NUM_FIELD_NAME,
            CODE_FIELD_NAME,
            USAGE_FIELD_NAME,
            REMARK_FIELD_NAME,
        };

        #endregion


        #region 检查多边形是否可用时的错误信息
        public const String IPOLYGON_NULL = "IPolygon is null";
        public const String IPOLYGON_EMPTY = "IPolygon is empty";
        public const String IPOLYGON_IS_NOT_CLOSE = "IPolygon is not close";
        public const String IPOLYGON_TOPOLOGICAL_ERROR = "IPolygon topological error";

        public const String IPOLYGON4_NULL = "IPolygon4 is null";
        public const String IPOLYGON4_EXTERIOR_RING_COUNT_ZERO = "IPolygon4 多边形外环数为0";
        public const String IPOLYGON4_TOPOLOGICAL_ERROR = "IPolygon4 topological error";

        public const String NO_ERROR = "no error";
        public const String CONVERT_ERROR = "强转时发生错误"; 
        #endregion


        #region 坐标系
        public const Int32 Prj38Code = (Int32)esriSRProjCS4Type.esriSRProjCS_Xian1980_3_Degree_GK_Zone_38;
        #endregion

        #region 错误代码
        /// <summary>
        /// 创建有内外环的多边形时，外环发生错误
        /// </summary>
        internal const Int32 EC11704 = 11704;

        /// <summary>
        /// 创建有内，外环的多边形时，内环发生错误
        /// </summary>
        internal const Int32 EC11705 = 11705;

        /// <summary>
        /// 成功，无错误
        /// </summary>
        internal const Int32 EC_NONE = 0;

        /// <summary>
        /// 创建Ring时,所创建环的方向与期望的不同
        /// </summary>
        internal const Int32 EC11702 = 11702;

        /// <summary>
        /// 创建Ring时得到IsEmpty=true
        /// </summary>
        internal const Int32 EC11700 = 11700;

        /// <summary>
        /// 创建Ring时,isClosed = false
        /// </summary>
        internal const Int32 EC11701 = 11701;

        /// <summary>
        /// 使用CanUse2返回的错误代码
        /// </summary>
        internal const Int32 EC11900 = 11900;
        internal const Int32 EC11901 = 11901;
        internal const Int32 EC11902 = 11902;
        internal const Int32 EC11903 = 11903;
        internal const Int32 EC11904 = 11904;
        internal const Int32 EC11905 = 11905;
        internal const Int32 EC11906 = 11906;
        internal const Int32 EC11907 = 11907;
            
        #endregion
    }
}
